-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make-derivation.nix: lib.warn if drv.__spliced missing #263082
Conversation
Proof that we are not splicing Rust hooks: check out this PR, then run:
in the output you'll see:
|
Is similar to #204387 |
Well, I think they're sort of orthogonal (and both are a good idea). It looks like You should merge yours first since mine isn't done and is easier to rebase. |
Befofe merge there should be a way to fix the warning. We should find out a way to splice or work around the lack of splicing when a function that returns derivation(s) is used (without adding it to be reachable from top-level). Maybe a callPackage like func which internally calls with the various sets callPackage's, but a issue would still be what the user passes if it was not already spliced (eg overrideAttrs was used).
Explicitly used sets like buildPackages won't have a __spliced in packages |
The way to do that is to have all derivations be spliced, always, all the time. Then we don't have to worry about it. In other words, do the splicing in |
I think that's the point. Those should never be used in depsFooBar. They should only be used when you need to interpolate into a string, like |
This comment was marked as resolved.
This comment was marked as resolved.
# shame on you, llvm! | ||
"llvm" | ||
"compiler-rt" | ||
"libcxx" | ||
"libcxxabi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the llvm sets use the normal makeScope
and that's why there's no __spliced
's in the sets own callPackage
I'm little by little working on making the sets better #253671
once I dedupe more stuff it'll be much easier to dedupe and improve the llvm/*/default.nix
'es
Nice list name.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@@ -15,7 +16,7 @@ stdenv.mkDerivation rec { | |||
hash = "sha256-yosEmjwtOyIloejRXWE3mOvHSOOVA4jtomlN5Qe6YCA="; | |||
}; | |||
|
|||
nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.cracklib; | |||
nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) cracklib; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to get more fit in cross: Shouldn't this use canExecute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is what you mean, then yes, that would be an improvement (let's put it in a separate PR though -- one thing at a time).
diff --git a/pkgs/development/libraries/cracklib/default.nix b/pkgs/development/libraries/cracklib/default.nix
index ba5d96a95182..defdb2965173 100644
--- a/pkgs/development/libraries/cracklib/default.nix
+++ b/pkgs/development/libraries/cracklib/default.nix
@@ -15,10 +15,10 @@ stdenv.mkDerivation rec {
hash = "sha256-yosEmjwtOyIloejRXWE3mOvHSOOVA4jtomlN5Qe6YCA=";
};
- nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.cracklib;
+ nativeBuildInputs = lib.optional (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) buildPackages.cracklib;
buildInputs = [ zlib gettext ];
- postPatch = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+ postPatch = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
chmod +x util/cracklib-format
patchShebangs util
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes against your comment below about using buildPackages
in nativeBuildInputs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes against your comment below about using
buildPackages
innativeBuildInputs
.
Indeed! Nice catch. If this PR were merged CI would have caught that.
The patch above should, in addition to the changes it makes, also delete the buildPackages.
before cracklib
.
Fixes warnings with NixOS#263082 applied Update pkgs/development/libraries/ncurses/default.nix Co-authored-by: Artturi <Artturin@artturin.com> ncurses: Explicitly use buildPackages for --with-build-cc stdenv.cc worked for me because my nixos was configured to use boot.binfmt.emulatedSystems.
Fixes warnings with NixOS#263082 applied Update pkgs/development/libraries/ncurses/default.nix Co-authored-by: Artturi <Artturin@artturin.com> ncurses: Explicitly use buildPackages for --with-build-cc stdenv.cc worked for me because my nixos was configured to use boot.binfmt.emulatedSystems.
In order to avoid setting off the unspliced-dependency check, we need to make sure that the targetPackages.stdenv.cc.bintools used by gcc gets spliced. In order for it to be spliced, it needs a top-level entry in all-packages.nix. Therefore, this commit adds one. This also causes us to stop abusing targetPackages to access the linker, which is a good thing.
This commit adds a `lib.warn` check to stdenv.mkDerivation, causing it to emit a warning if a dependency which ought to be spliced in fact is not.
Co-authored-by: Artturi <Artturin@artturin.com>
…s in buildInputs" This reverts commit 0899b6b8746790eec9dc49ea4f4a6c3def072e3b.
Fixed merge conflict. |
@amjoseph-nixpkgs can we merge this soon? |
@amjoseph-nixpkgs What do you think about merging this so that it forces the issue of fixing packages for cross? I would personally like it so that I can hunt down the cross issues in all of my out of tree packages. |
@amjoseph-nixpkgs 23.11 branched off a while ago. Can we merge this? |
@amjoseph-nixpkgs why close this? I found this useful when trying to figure out why some of my cross pkgs were broken. |
@kjeremy I think this PR was closed in in the light of #50105 (comment). While not necessary, Adam chose to closed some of their open PRs (which is of cause okay if they like to do so). |
This should wait until after 23.11, but I'd like to try to merge it fairly promptly thereafter.
Right now when an unspliced package appears as a dependency, we just silently do the wrong thing, cross our fingers, and hope for the best. This is the reason why troubleshooting cross compilation is such a headache.
This PR adds a
lib.warn
for this situation when cross compiling. So we still do the wrong thing, but at least we tell the user that something is probably wrong. The warning will also cause CI to fail. I fixed about a dozen of these failures. Thelist-of-shame
provides an escape hatch for urgent situations.The
list-of-shame
currently has (about) two dozen of these splicing failures; these are ignored in order to get CI to pass. The idea is to get a check like this in place to prevent even more of these bugs from occurring while we work to eliminate the ones that are already there. Sincelib.warn
causes CI failures this will prevent people from introducing any more of these bugs (or else force them to add their stinky deeds to the list of shame).